package lecture19;

import java.io.IOException;
import java.util.Scanner;

public class Person {

	private String name;
	
	void setName(String name) {
		this.name = name;
	}
	
	
	boolean hasSameName(Person p) throws ITTalentsException {
		try {
			int[] x = new int[10];
			x[21] = 13;
			Scanner sc = new Scanner(System.in);
			int xo = sc.nextInt();
			return this.name.equals(p.name);
		} 
		catch (NullPointerException e) {
			System.out.println("Name of your initial person is null.");
			System.out.println(e.getMessage());
			System.out.println(e.getClass());
			System.out.println(e.getStackTrace());
			System.out.println(e.toString());
			System.out.println(e.getCause());
			for(StackTraceElement s : e.getStackTrace()) {
				System.out.println(s.getMethodName() + s.toString() + ": " + s.getLineNumber());
			}
			return false;
		}
		catch(ArrayIndexOutOfBoundsException e) {
			System.out.println("You are out of bounds, dude! Check your indexes!");
			throw new ITTalentsException("Error message", e);
		}
	}
	
	
	
}
